﻿namespace PMS.Client
{
    using DevComponents.DotNetBar;
    using DevComponents.DotNetBar.Controls;
    using PMS.Client.Properties;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Threading;
    using System.Windows.Forms;

    public class FrmLoading : Form
    {
        private BackgroundWorker bgw = new BackgroundWorker();
        private IContainer components = null;
        private Label lbTitle;
        private ProgressBarX progressBarX1;

        public FrmLoading()
        {
            this.InitializeComponent();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            this.progressBarX1 = new ProgressBarX();
            this.lbTitle = new Label();
            base.SuspendLayout();
            this.progressBarX1.BackgroundStyle.Class = "";
            this.progressBarX1.BackgroundStyle.CornerType = eCornerType.Square;
            this.progressBarX1.Dock = DockStyle.Bottom;
            this.progressBarX1.Location = new Point(0, 0xee);
            this.progressBarX1.Name = "progressBarX1";
            this.progressBarX1.Size = new Size(390, 0x13);
            this.progressBarX1.Style = eDotNetBarStyle.OfficeXP;
            this.progressBarX1.TabIndex = 1;
            this.progressBarX1.Text = "progressBarX1";
            this.lbTitle.BackColor = Color.Transparent;
            this.lbTitle.Dock = DockStyle.Bottom;
            this.lbTitle.Location = new Point(0, 0xd7);
            this.lbTitle.Name = "lbTitle";
            this.lbTitle.Size = new Size(390, 0x17);
            this.lbTitle.TabIndex = 2;
            this.lbTitle.Text = "初始化.....";
            this.lbTitle.TextAlign = ContentAlignment.MiddleCenter;
            this.lbTitle.Visible = false;
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.AutoScaleMode = AutoScaleMode.Font;
            this.BackgroundImage = Resources.loading;
            this.BackgroundImageLayout = ImageLayout.None;
            base.ClientSize = new Size(390, 0x101);
            base.Controls.Add(this.lbTitle);
            base.Controls.Add(this.progressBarX1);
            base.FormBorderStyle = FormBorderStyle.None;
            base.Name = "FrmLoading";
            base.ShowInTaskbar = false;
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "FrmLoading";
            base.ResumeLayout(false);
        }

        public void UpdateUIEvent(int count, string content)
        {
            for (int i = 0; i < count; i++)
            {
                this.progressBarX1.Value++;
                Thread.Sleep(10);
            }
            if (this.progressBarX1.Value == 100)
            {
                base.Close();
            }
        }
    }
}

